libc ,
contains all the symbols listed in the Generic ABI, as well as
the routines listed in the following figures:
_cleanup _numeric modf
getitimer gettimeofday makecontext logb nextafter scalb select setlabel setitimer swapcontext sysinfoNote that the following routines are listed in Generic ABI as Names without Synonyms.
fopen vfprintf vprintf vsprintf
Operating system implementors should note that the SVR4 definition
of gettimeofday() differs from the BSD4.3 version.
libc.so.1 must include the entry points _xstat and _lstat which
are used to implement the stat interface. Application programmers
should not use the _xstat and _lstat interfaces, and should take
care to include stat.h. Failure to include stat.h may result in
invoking the older (pre-EFT) stat interface leading to erroneous
results in the application.
All development environments for ABI applications shall contain
ABI conforming versions of
libm.a.
The MIPS psABI
shall define the path to the directory that contains these libraries.
The following are entry-points that must be defined for each respective
library, as defined in Issue 3 of the SVID.
acos acosh asin asinh atan2 atanh cbrt ceil cos cosh erf erfc exp fabs floor fmod gamma j0 j1 jn lgamma log log10 pow remainder sin sinh sqrt tan tanh y0 y1 yn
cc [flag ...] file ... -lmutex [library ...] #includeThese functions supply a user-level interface to mutual exclusion. The parameterint init_lock(abilock_t *lck) int acquire_lock(abilock_t *lck) int release_lock(abilock_t *lck) int stat_lock(abilock_t *lck)
lck
must point to memory shared by
all processes wishing to acquire or test the lock.
The library routines might not contain checks for the validity (e.g. non-null value) of
the
lck
parameter.
The contents of the structure
abilock_t
are as follows:
typedef struct { unsigned long abi_lock; } abilock_t;The function
init_lock
must be called on a lock before any of the other functions.
It initializes the lock to an unlocked state.
A non-zero return status will indicate an error.
acquire_lock
tries once to acquire the lock referenced by
lck.
It returns zero if the lock was acquired, otherwise non-zero.
stat_lock
returns the current state of the lock referenced by
lck
without attempting to acquire the lock.
It returns zero if the lock is free, otherwise non-zero.
release_lock
unconditionally releases the lock pointed to by
lck.
The ability for one process to release the lock of another
process is permitted.
A non-zero return status will indicate an error.
Locks may not be freed automatically by the system.
Locks acquired by a process that dies may remain locked.
The user is responsible for implementing a back-off policy if acquire_lock returns failure.
Even though stat_lock returns status indicating that the
lock is available, a call to acquire_lock could still fail.
cc
command line.
The behavior of a zero queue length (the second argument)
to the libsocket routine
listen
is undefined.
accept bind connect endhostent endnetent endprotoent endservent ether_aton ether_hostton ether_line ether_ntoa ether_ntohost gethostbyaddr gethostbyname gethostent getnetbyaddr getnetbyname getnetent getpeername getprotobyname getprotobynumber getprotoent getservbyname getservbyport getservent getsockname getsockopt htonl htons inet_addr inet_lnaof inet_makeaddr inet_netof inet_network inet_ntoa listen ntohl ntohs recv recvfrom recvmsg send sendmsg sendto sethostent setnetent setprotoent setservent setsockopt shutdown socket socketpair
#define IFF_UP 0x1 #define IFF_BROADCAST 0x2 #define IFF_DEBUG 0x4 #define IFF_LOOPBACK 0x8 #define IFF_POINTOPOINT 0x10 #define IFF_NOTRAILERS 0x20 #define IFF_RUNNING 0x40 #define IFF_NOARP 0x80 #define IFF_PROMISC 0x100 #define IFF_ALLMULTI 0x200 #define IFF_INTELLIGENT 0x400 #define IFF_MULTICAST 0x800 #define IFF_PRIVATE 0x8000 struct ifreq { #define IFNAMSIZ 16 char ifr_name[IFNAMSIZ]; union { struct sockaddr ifru_addr; struct sockaddr ifru_dstaddr; char ifru_oname[IFNAMSIZ]; struct sockaddr ifru_broadaddr; short ifru_flags; int ifru_metric; char ifru_data[1]; char ifru_enaddr[6]; } ifr_ifru; #define ifr_addr ifr_ifru.ifru_addr #define ifr_dstaddr ifr_ifru.ifru_dstaddr #define ifr_oname ifr_ifru.ifru_oname #define ifr_broadaddr ifr_ifru.ifru_broadaddr #define ifr_flags ifr_ifru.ifru_flags #define ifr_metric ifr_ifru.ifru_metric #define ifr_data ifr_ifru.ifru_data #define ifr_enaddr ifr_ifru.ifru_enaddr }; struct ifconf { int ifc_len; union { caddr_t ifcu_buf; struct ifreq *ifcu_req; } ifc_ifcu; #define ifc_buf ifc_ifcu.ifcu_buf #define ifc_req ifc_ifcu.ifcu_req };
struct arpreq { struct sockaddr arp_pa; struct sockaddr arp_ha; int arp_flags; }; #define ATF_INUSE 0x01 #define ATF_COM 0x02 #define ATF_PERM 0x04 #define ATF_PUBL 0x08 #define ATF_USETRAILERS 0x10
typedef u_char ether_addr_t[6];
#define ntohl(x) (x) #define ntohs(x) (x) #define htonl(x) (x) #define htons(x) (x) struct in_addr { u_long s_addr; }; struct sockaddr_in { short sin_family; u_short sin_port; struct in_addr sin_addr; char sin_zero[8]; }; #define IPPROTO_IP 0 #define IPPROTO_ICMP 1 #define IPPROTO_IGMP 2 #define IPPROTO_GGP 3 #define IPPROTO_TCP 6 #define IPPROTO_EGP 8 #define IPPROTO_PUP 12 #define IPPROTO_UDP 17 #define IPPROTO_IDP 22 #define IPPROTO_HELLO 63 #define IPPROTO_ND 77 #define IPPROTO_RAW 255 #define IPPROTO_MAX 256 #define IP_OPTIONS 1 #define IP_MULTICAST_IF 2 /* may not be supported */ #define IP_MULTICAST_TTL 3 /* may not be supported */ #define IP_MULTICAST_LOOP 4 /* may not be supported */ #define IP_ADD_MEMBERSHIP 5 /* may not be supported */ #define IP_DROP_MEMBERSHIP 6 /* may not be supported */ #define IP_HDRINCL 7 /* may not be supported */ #define IP_TOS 8 /* may not be supported */ #define IP_TTL 9 /* may not be supported */ #define IP_RECVOPTS 10 /* may not be supported */ #define IP_RECVRETOPTS 11 /* may not be supported */ #define IP_RECVDSTADDR 12 /* may not be supported */ #define IP_RETOPTS 13 /* may not be supported */
#define TCP_NODELAY 0x01 #define TCP_MAXSEG 0x02
#define IOCPARM_MASK 0xff #define IOC_VOID 0x20000000 #define IOC_OUT 0x40000000 #define IOC_IN 0x80000000 #define IOC_INOUT (IOC_IN|IOC_OUT) #define _IO(x,y) (IOC_VOID|(x<<8)|y) #define _IOR(x,y,t) (IOC_OUT|((((int)sizeof(t))\e &IOCPARM_MASK)<<16)|(x<<8)|y) #define _IORN(x,y,t) (IOC_OUT|(((t)\e &IOCPARM_MASK)<<16)|(x<<8)|y) #define _IOW(x,y,t) (IOC_IN|((((int)sizeof(t))\e &IOCPARM_MASK)<<16)|(x<<8)|y) #define _IOWN(x,y,t) (IOC_IN|(((t)\e &IOCPARM_MASK)<<16)|(x<<8)|y) #define _IOWR(x,y,t) (IOC_INOUT|((((int)sizeof(t))\e &IOCPARM_MASK)<<16)|(x<<8)|y) #define SIOCSHIWAT _IOW('s', 0, int) #define SIOCGHIWAT _IOR('s', 1, int) #define SIOCSLOWAT _IOW('s', 2, int) #define SIOCGLOWAT _IOR('s', 3, int) #define SIOCATMARK _IOR('s', 7, int) #define SIOCSPGRP _IOW('s', 8, int) #define SIOCGPGRP _IOR('s', 9, int) #define SIOCADDRT _IOW('r', 10, struct rtentry) #define SIOCDELRT _IOW('r', 11, struct rtentry) #define SIOCSIFADDR _IOW('i', 12, struct ifreq) #define SIOCGIFADDR _IOWR('i',13, struct ifreq) #define SIOCSIFDSTADDR _IOW('i', 14, struct ifreq) #define SIOCGIFDSTADDR _IOWR('i',15, struct ifreq) #define SIOCSIFFLAGS _IOW('i', 16, struct ifreq) #define SIOCGIFFLAGS _IOWR('i',17, struct ifreq) #define SIOCSIFMEM _IOW('i', 18, struct ifreq) #define SIOCGIFMEM _IOWR('i',19, struct ifreq) #define SIOCGIFCONF _IOWR('i',20, struct ifconf) #define SIOCSIFMTU _IOW('i', 21, struct ifreq) #define SIOCGIFMTU _IOWR('i',22, struct ifreq) #define SIOCGIFBRDADDR _IOWR('i',23, struct ifreq) #define SIOCSIFBRDADDR _IOW('i',24, struct ifreq) #define SIOCGIFNETMASK _IOWR('i',25, struct ifreq) #define SIOCSIFNETMASK _IOW('i',26, struct ifreq) #define SIOCGIFMETRIC _IOWR('i',27, struct ifreq) #define SIOCSIFMETRIC _IOW('i',28, struct ifreq) #define SIOCSARP _IOW('i', 30, struct arpreq) #define SIOCGARP _IOWR('i',31, struct arpreq) #define SIOCDARP _IOW('i', 32, struct arpreq) #define SIOCUPPER _IOW('i', 40, struct ifreq) #define SIOCLOWER _IOW('i', 41, struct ifreq) #define SIOCSETSYNC _IOW('i', 44, struct ifreq) #define SIOCGETSYNC _IOWR('i', 45, struct ifreq) #define SIOCSSDSTATS _IOWR('i', 46, struct ifreq) #define SIOCSSESTATS _IOWR('i', 47, struct ifreq) #define SIOCSPROMISC _IOW('i', 48, int) #define SIOCADDMULTI _IOW('i', 49, struct ifreq) #define SIOCDELMULTI _IOW('i', 50, struct ifreq) #define SIOCPROTO _IOW('s', 51, struct socknewproto) #define SIOCGETNAME _IOR('s', 52, struct sockaddr) #define SIOCGETPEER _IOR('s', 53, struct sockaddr) #define IF_UNITSEL _IOW('s', 54, int) #define SIOCXPROTO _IO('s', 55) #define SIOCIFDETACH _IOW('i', 56, struct ifreq) #define SIOCGENPSTATS _IOWR('i', 57, struct ifreq) #define SIOCX25XMT _IOWR('i', 59, struct ifreq) #define SIOCX25RCV _IOWR('i', 60, struct ifreq) #define SIOCX25TBL _IOWR('i', 61, struct ifreq) #define SIOCSLGETREQ _IOWR('i', 71, struct ifreq) #define SIOCSLSTAT _IOW('i', 72, struct ifreq) #define SIOCSIFNAME _IOW('i', 73, struct ifreq) #define SIOCGENADDR _IOWR('i', 85, struct ifreq) #define SIOCSOCKSYS _IOW('i', 86, struct socksysreq)
struct hostent { char *h_name; char **h_aliases; int h_addrtype; int h_length; char **h_addr_list; #define h_addr h_addr_list[0] }; struct netent { char *n_name; char **n_aliases; int n_addrtype; unsigned long n_net; }; struct protoent { char *p_name; char **p_aliases; int p_proto; }; struct servent { char *s_name; char **s_aliases; int s_port; char *s_proto; };
struct rtentry { u_long rt_hash; struct sockaddr rt_dst; struct sockaddr rt_gateway; short rt_flags; short rt_refcnt; u_long rt_use; union { struct ip_provider *rtu_prov; struct ifnet *rtu_ifp; } rt_u; #define rt_prov rt_u.rtu_prov #define rt_ifp rt_u.rtu_ifp }; #define RTF_UP 0x1 #define RTF_GATEWAY 0x2 #define RTF_HOST 0x4 #define RTF_REINSTATE 0x8 #define RTF_DYNAMIC 0x10 #define RTF_MODIFIED 0x20 #define RTF_SWITCHED 0x40 #define RTF_SLAVE 0x80 #define RTF_REMOTE 0x100 #define RTF_TOSWITCH 0x200
#define AF_UNSPEC 0 #define AF_UNIX 1 #define AF_INET 2 #define AF_IMPLINK 3 #define AF_PUP 4 #define AF_CHAOS 5 #define AF_NS 6 #define AF_NBS 7 #define AF_ECMA 8 #define AF_DATAKIT 9 #define AF_CCITT 10 #define AF_SNA 11 #define AF_DECnet 12 #define AF_DLI 13 #define AF_LAT 14 #define AF_HYLINK 15 #define AF_APPLETALK 16 #define AF_NIT 17 #define AF_802 18 #define AF_OSI 19 #define AF_X25 20 #define AF_OSINET 21 #define AF_GOSIP 22 struct sockaddr { u_short sa_family; char sa_data[14]; }; #define SO_DEBUG 0x0001 #define SO_ACCEPTCONN 0x0002 #define SO_REUSEADDR 0x0004 #define SO_KEEPALIVE 0x0008 #define SO_DONTROUTE 0x0010 #define SO_BROADCAST 0x0020 #define SO_USELOOPBACK 0x0040 #define SO_LINGER 0x0080 #define SO_OOBINLINE 0x0100 #define SO_IMASOCKET 0x0400 #define SOL_SOCKET 0xffff struct linger { int l_onoff; int l_linger; }; #define SOCK_DGRAM 1 #define SOCK_STREAM 2 #define SOCK_RAW 4 #define SOCK_RDM 5 #define SOCK_SEQPACKET 6 #define PF_UNSPEC AF_UNSPEC #define PF_UNIX AF_UNIX #define PF_INET AF_INET #define PF_IMPLINK AF_IMPLINK #define PF_PUP AF_PUP #define PF_CHAOS AF_CHAOS #define PF_NS AF_NS #define PF_NBS AF_NBS #define PF_ECMA AF_ECMA #define PF_DATAKIT AF_DATAKIT #define PF_CCITT AF_CCITT #define PF_SNA AF_SNA #define PF_DECnet AF_DECnet #define PF_DLI AF_DLI #define PF_LAT AF_LAT #define PF_HYLINK AF_HYLINK #define PF_APPLETALK AF_APPLETALK #define PF_NIT AF_NIT #define PF_802 AF_802 #define PF_OSI AF_OSI #define PF_X25 AF_X25 #define PF_OSINET AF_OSINET #define PF_GOSIP AF_GOSIP struct msghdr { caddr_t msg_name; int msg_namelen; struct iovec *msg_iov; int msg_iovlen; caddr_t msg_accrights; int msg_accrightslen; }; #define MSG_OOB 0x1 #define MSG_PEEK 0x2 #define MSG_DONTROUTE 0x4 struct socknewproto { int family; int type; int proto; dev_t dev; int flags; }; struct socksysreq { int args[7]; };
#ifndef FD_SETSIZE #define FD_SETSIZE 1024 #endif #ifndef NBBY #define NBBY 8 #endif typedef long fd_mask; #define NFDBITS (sizeof(fd_mask) * NBBY) #ifndef howmany #define howmany(x, y) (((x)+((y)-1))/(y)) #endif typedef struct fd_set { fd_mask fds_bits[howmany(FD_SETSIZE, NFDBITS)]; } fd_set; #define FD_SET(n, p) ((p)->fds_bits[(n)/NFDBITS] \e |= (1 << ((n) % NFDBITS))) #define FD_CLR(n, p) ((p)->fds_bits[(n)/NFDBITS] \e &= ~(1 << ((n) % NFDBITS))) #define FD_ISSET(n, p) ((p)->fds_bits[(n)/NFDBITS] \e & (1 << ((n) % NFDBITS))) #define FD_ZERO(p) memset((char *)(p), 0, sizeof(*(p)))
libucb.a
provides many of the popular interfaces from BSD UNIX.
It is
intended to be used as a migration path for ISVs moving applications
from BSD UNIX to SVR4.
Over time all ISVs are encouraged to move to
the SVR4 ABI interfaces since they may not be supported in the future.
It is also important to note that use of
libucb.a
pulls in all of its BSD interfaces.
This can result in
subtle problems for applications which mix BSD and SVR4 interfaces,
for example using the BSD printf and SVR4 readdir.
In the previous case, both the
printf
and
readdir
calls would use the BSD version.
This class of problem will be exposed at runtime rather than compile time.
alloca alphasort bcmp bcopy bzero dbm_close dbm_delete dbm_do_nextkey dbm_fetch dbm_firsthash dbm_firstkey dbm_forder dbm_nextkey dbm_open dbm_store dc endusershell fopen fp_accrued_exceptions fp_class_d fp_class_f fp_direction fp_precision fprintf ftime getdtablesize gethostid gethostname getpagesize getrusage getusershell getwd ieee_handlers index initstate isnan killpg longjmp mctl mkstemp printf psignal rand random re_comp re_exec readdir rindex scandir sethostname setjmp setstate setusershell sigblock sigfpe siginterrupt signal sigpause sigsetmask sigstack sigvec sleep sprintf srand srandom strcasecmp strncasecmp sys_siglist times timezone ualarm usleep utimes vfprintf vprintf vsprintf wait3
The basic X11 support library, libX11 shall be supported as a DSO, libX11.so.2, by ABI-conforming systems. (libX11.so.1 is reserved for implementations that may have had X11R4 versions.) The X Toolkit Intrinsics library, libXt, is supplied as a static archive in the ABI build environment. An ABI-conforming system shall provide the following include files whose content is defined by the X11R5 Reference Manual.
X11/cursorfont.h X11/keysymdef.h X11/X.h X11/Xatom.h X11/Xcms.h X11/Xlib.h X11/Xproto.h X11/Xresource.h X11/Xutil.h
X11/Intrinsic.h X11/IntrinsicP.h X11/Shell.h X11/ShellP.h X11/StringDefs.h X11/Vendor.h X11/VendorP.h
An ABI-conforming system shall provide the following include files whose content is defined by the OSF/Motif Programmer's Reference Manual.
Xm/ArrowB.h Xm/ArrowBG.h Xm/BulletinB.h Xm/CascadeB.h Xm/CascadeBG.h Xm/Command.h Xm/CutPaste.h Xm/DialogS.h Xm/DrawingA.h Xm/DrawnB.h Xm/FileSB.h Xm/Form.h Xm/Frame.h Xm/Label.h Xm/LabelG.h Xm/List.h Xm/MainW.h Xm/MenuShell.h Xm/MessageB.h Xm/PanedW.h Xm/Protocols.h Xm/PushB.h Xm/PushBG.h Xm/RowColumn.h Xm/Scale.h Xm/ScrollBar.h Xm/ScrolledW.h Xm/SelectioB.h Xm/SeparatoG.h Xm/Separator.h Xm/Text.h Xm/ToggleB.h Xm/ToggleBG.h Xm/Xm.h Xm/XmP.h
The placement of a shared memory or mapped file region by a program must follow these rules:
Implementors using mmap() are advised that the gABI requires
libdl
library allows users to dynamically link shared
libraries after a program is launched.
Shared libraries are accessed with
dlopen()
and released with
dlclose().
Symbols in shared libraries opened via
dlopen()
can be located by calling
dlsym().
If an error occurs,
dlerror()
provides a formatted error message that describes the problem.
libdl
provides the following routines:
cc [flag ...] file ... -ldl [library ...] void *dlopen(char *pathname, int mode); /* returns a handle for future dlclose() * and dlsym() calls */ int dlclose(void *handle); /* returns zero on success, non-zero otherwise */ void *dlsym(void *handle, char *name); /* returns the address of the symbolComplete information is provided in the UNIX SVR4 Programmer's Reference Manual., * else NULL if not found */ char *dlerror(void); /* returns formatted string of last error */
Implementation notes:
dlopen()
looks for
DT_NEEDED
entries in the
\&.dynamic
section of the shared library it opens and, for each entry, invokes
dlopen()
on the shared library entry names.
This process recurses until all
libraries specified by
DT_NEEDED
entries have been loaded.
In no case will the dynamic linker link in a shared library twice.
dlclose()
unmaps the shared library associated with the handle passed to
it and any other libraries that were linked via the recursive process
described above.
It guarantees that a library is not unlinked until
all the references to it are closed.
dlsym()
restricts its search to the shared libraries linked by the
dlopen()
that created its handle.
The search looks first in the
shared library referenced by the handle and then recursively traverses
libraries named in
DT_NEEDED
entries in a breadth-first order.
dlerror()
returns an English message;
it is not internationalized.
libdl
library is implemented as shared library,
libdl.so.
It is installed in
/usr/lib.
sysinfo.
The new and recommended routines are described below, along with examples.
A
sysinfo
header file, including the additional commands, follows.
See vendor release notes for vendor values.
buf
a string which is
the name of the company providing the system.
The vendor is the company actually selling the product
rather than the company which built the product.
Example: Mips Computer Systems, Inc.
buf
a string which is
the ASCII representation of the number of processors.
This should be the number of currently active, available processors.
Application developers should use this value cautiously.
In some systems, this value does not reflect processors which
have been previously allocated to other tasks and are unavailable
for further allocation.
buf
a string which is
the ASCII representation of the OS patch release number.
Release patch (5.01) is an example:
_MIPS_SI_OSREL_MAJ: 5 _MIPS_SI_OSREL_MIN: 01 _MIPS_SI_OSREL_PATCH 0
buf
a string which is processor type.
In the case of a multiprocessor, this will be a comma separated
list with
_MIPS_SI_NUM_PROCESSORS
entries.
OS implementors: The following is the mapping from the value
returned by the chip's "imp" register to the processor type string which
should be returned.
imp processor name 0 R2000 1 R2000 2 R2000 3 R2000 6 R2000 4 R2000
There are no additions to the system level commands.
The following figure shows the
systeminfo.h
file.
#define SI_SYSNAME 1 #define SI_HOSTNAME 2 #define SI_RELEASE 3 #define SI_VERSION 4 #define SI_MACHINE 5 #define SI_ARCHITECTURE 6 #define SI_HW_SERIAL 7 #define SI_HW_PROVIDER 8 #define SI_SRPC_DOMAIN 9 #define _MIPS_SI_VENDOR 100 #define _MIPS_SI_OS_PROVIDER 101 #define _MIPS_SI_OS_NAME 102 #define _MIPS_SI_HW_NAME 103 #define _MIPS_SI_NUM_PROCESSORS 104 #define _MIPS_SI_HOSTID 105 #define _MIPS_SI_OSREL_MAJ 106 #define _MIPS_SI_OSREL_MIN 107 #define _MIPS_SI_OSREL_PATCH 108 #define _MIPS_SI_PROCESSORS 109
Back to the Table of Contents
Back to the MIPS ABI Home Page
Copyright © 1995, MIPS ABI Group, Incorporated.